package moe.oil.api.databaseAPI;

import moe.oil.authority.annotation.Permit;
import moe.oil.authority.enumeration.Role;
import moe.oil.dto.user.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "database-service",contextId = "UserAPI")
public interface UserAPI {

    @GetMapping("/user")
    public List<UserDTO> getAll(@RequestParam(value = "page",name = "page") int page, @RequestParam(value = "size",name = "size") int size);

    @Permit(Role.ADMIN)
    @PostMapping("/user/insert")
    public UserDTO insert(@RequestBody UserDTO userDTO);


    @GetMapping("/user/test")
    public String test();
}
